library(tidyverse)


dat = data.table::fread("results/matrix_of_commons.csv")
dat$V1 = stringr::str_remove(dat$V1, "indices_eo_")
rownames(dat) = dat$V1
colnames(dat) = c("V1", dat$V1)
dat2 = reshape2::melt(dat, "V1")

dat2$V1 = factor(dat2$V1)
dat2$variable = factor(dat2$variable,
                        levels=levels(dat2$V1))
dat2$Overlap = dat2$value




ggplot(dat2, aes(x = V1, y=variable)) +
  geom_tile(aes(fill=Overlap)) + 
  theme(axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1)) +
  xlab("Method") + ylab("Method")

ggsave("results/figA2_overlap.pdf")

tmp = unlist(dat[,-1])
tmp = tmp[tmp != 1000]

# Appendix Figure 2 Caption
mean(tmp)
median(tmp)
